package com.project.server.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.server.model.Dish;
import com.project.server.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface DishMapper extends BaseMapper<Dish> {

    /**
     * 获取餐厅的热销菜品
     */
    @Select("SELECT * FROM dish WHERE status = 1 ORDER BY sales DESC LIMIT #{pageSize}")
    List<Dish> getHotDishes(Long limit);

    Page<DishVO> getDishPage(Page<Dish> page,
                            @Param("name") String name,
                            @Param("categoryId") Long categoryId,
                            @Param("restaurantId") Long restaurantId,
                            @Param("status") Integer status);

    List<DishVO> getByRestaurantId(Long id);

}
